package com.abm.entity;



import android.app.Activity;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;

public class Actividad extends Activity {

	public static boolean cerrarAplicacion;
	private static boolean custom;
	public static final int MENU_SALIR = Menu.FIRST;

	public static final int MENU_ACERCADE = Menu.FIRST + 1;

	public static boolean desconectadoDelServidor = false;
	public static boolean appRunning = false;
	public static boolean islogueado = false;
	public static int sat_count;
	public static boolean enviarLoginDesconectado;
	public static int NOTIFICATION = android.R.string.yes;
	public static NotificationManager mNM;
	public static String TAG = "ACTIVIDAD";
	Intent intent;
	static final int NOTIFICATION_ID = 1593;

	public Context mContext;

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
		super.onCreate(savedInstanceState);

		if (!isTaskRoot()) {

			final Intent intent = getIntent();
			final String intentAction = intent.getAction();
			if (intent.hasCategory(Intent.CATEGORY_LAUNCHER)
					&& intentAction != null
					&& intentAction.equals(Intent.ACTION_MAIN)) {
				Log.i(TAG,
						"Main Activity is not the root.  Finishing Main Activity instead of launching.");
				finish();
				return;
			}
		}

		// setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

		// getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.bg3));
		custom = customTitleSupported;
		mContext = getApplicationContext();

	}

	@Override
	public void setContentView(int id) {
		try {
			super.setContentView(id);
			setTitle();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	@SuppressWarnings("null")
	public static void ActivarMenuItem(int Opsel) {
		MenuItem menu = null;
		switch (Opsel) {
		case MENU_ACERCADE:
			((MenuItem) menu).setEnabled(true);

		}
	}

	public void setTitle() {

		if (custom) {
			// getWindow().setFeatureInt(Window.FEATURE_NO_TITLE, 0);
			// getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
			// R.layout.);
		}
	}

	public void viewExit() {

	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {

		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem menu) {
			switch (menu.getItemId()) {

		case MENU_SALIR:
			viewExit();
			return true;
		case MENU_ACERCADE:

			return true;

		}
		return false;
	}

}
